import * as types from './mutation-types'

function findIndex(list, song) {
  return list.findIndex((item) => {
    return item.id === song.id
  })
}

export const selectPlay = function ({commit, state}, {list, index}) {
  return findIndex(types)
  // commit(types.SET_SEQUENCE_LIST, list)
  // if (state.mode === list.random) {
  //   let randomList = findIndex(list)
  //   commit(types.SET_PLAYLIST, randomList)
  //   index = findIndex(randomList, list[index])
  // } else {
  //   commit(types.SET_PLAYLIST, list)
  // }
  // commit(types.SET_CURRENT_INDEX, index)
  // commit(types.SET_FULL_SCREEN, true)
  // commit(types.SET_PLAYING_STATE, true)
}
